
<div class="form-group">
      <label class="col-sm-2 control-label">商品名称：</label>
      <div class="col-sm-7 must" >
          <input type="text" class="input-max" data-rule-maxlength="80" data-rule-required="true" data-msg-required="商品名称不能为空" name="goods_name" value="{$row.goods_name}" >
      </div>
</div>

<div class="form-group">
      <label class="col-sm-2 control-label">商品简称：</label>
      <div class="col-sm-5" >
          <input type="text" class="input-max" data-rule-maxlength="60"  name="short_name" value="{$row.short_name}" >
      </div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label">商品分类：</label>
    <div class="col-sm-3 must">
      <select name="cid"  style="width:100%;" data-toggle="select2" data-placeholder="选择分类" >
         <option value="">选择分类</option>
           {$classListOpt|raw}
        </select>
    </div>
</div>
<!-- <div class="form-group">
    <label class="col-sm-2 control-label">商品品牌：</label>
    <div class="col-sm-3 ">
      <select name="brand_id"  style="width:100%;" data-toggle="select2" >
         <option value="">选择品牌</option>
           {$brandListOpt|raw}
        </select>
    </div>
</div> -->

<!--<div class="form-group">-->
<!--    <label class="col-sm-2 control-label">身份产品：</label>-->
<!--    <div class="col-sm-3 ">-->
<!--        <select name="role_id"  style="width:100%;" data-toggle="select2" >-->
<!--            <option value="">请选择</option>-->
<!--            {volist name="UsersRole" id="urow" }-->
<!--            <option value="{$urow.role_id}" {$row.role_id==$urow.role_id?'selected':''}>{$urow.role_name}</option>-->
<!--            {/volist}-->
<!--        </select>-->
<!--    </div>-->
<!--</div>-->

<!-- <div class="form-group">-->
<!--    <label class="col-sm-2 control-label">免费产品：</label>-->
<!--    <div class="col-sm-3 ">-->
<!--        <select name="is_premiums"  style="width:100%;" data-toggle="select2" >-->
<!--            <option value="">请选择</option>-->
<!--            <option value="1" {$row.is_premiums==1?'selected':''}>是</option>-->
<!--        </select>-->
<!--    </div>-->
<!--</div> -->

<div class="form-group">
    <label class="col-sm-2 control-label">代理产品：</label>
    <div class="col-sm-3 ">
        <select name="is_type"  style="width:100%;" data-toggle="select2" >
            <option value="0">否</option>
            <option value="1" {$row.is_type==1?'selected':''}>省代理商品</option>
            <option value="2" {$row.is_type==2?'selected':''}>市代理商品</option>
            <option value="3" {$row.is_type==3?'selected':''}>区代理商品</option>
            <option value="4" {$row.is_type==4?'selected':''}>镇代理商品</option>
        </select>
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label">运费计算方式：</label>
    <div class="col-sm-10">
        <label class="radio-inline">
            <input name="undertake" value="0" {$row.freight_template|tplckval='=0','checked',true} class="js_undertake" type="radio">卖家承担运费
        </label>
        <label class="radio-inline">
            <input name="undertake" value="1" {$row['freight_template']>0 || $row['freight_template'] ==-1?'checked':''} class="js_undertake js_freight_container_show" type="radio">
            买家承担运费
        </label>
   <label class="js_freight_container" style="display:{$row['freight_template'] > 0 || $row['freight_template'] ==-1?'':'none'}; position:relative;">
            <select  name="freight_template" data-rule-required="true" aria-required="true" aria-invalid="true" >
            	<option value="-1" selected>-- 使用默认运费模板 --</option>
                 {volist name="ShippingTpl" id="sfrow" }
                  <option value="{$sfrow.sf_id}" {$row['freight_template']==$sfrow['sf_id']?'selected':''}>{$sfrow.sf_name}{$sfrow['is_default']==1?'(默认)':''}</option>
                 {/volist}
                 {empty name="ShippingTpl"}
                 <option value="0" selected>-- 没有运费模板 --</option>
                 {/empty}
             </select>
        </label>

    </div>
</div>
<div class="line line-dashed line-lg pull-in" style="width:98%;"></div>


<div class="form-group">
    <label class="col-sm-2 control-label" >商品视频：</label>

    <div class="col-sm-10">
        <div class="js_upload_container2">
            <div class="js_file_upload2 ">
                <button type="button" class="btn btn-default js_new_uploadvideo" data-submitname="Goodsvideo" data-count="20" data-uploadpath="{:url('mainAdmin/attachment/upvideo')}" data-delpath="{:url('mainAdmin/attachment/removevideo')}" data-data="{ 'gid':'{$row.goods_id|intval}' }" style="position: relative; z-index: 1;">商品视频</button>
                <span class="maroon">*</span>
                <span class="help-inline"></span>
            </div>
            <div class="uploadify-queue js_file_upload_queue2">
            </div>
            <ul class="ipost-list ui-sortable js_fileList2" data-required="true">
                {volist name="goods_imgs" id="gg2"  }
                {if condition="$gg2.goodsvideo neq '' " }
                <li class="imgbox" data-post-id="{$gg2.img_id}" data-path="{$gg2.goodsvideo}">
                    <a class="item_new_close item_close" href="javascript:void(0)" data-delpath="{:url('mainAdmin/attachment/removevideo')}"  title="删除" data-path="{$gg2.goodsvideo}" data-post-id="{$gg2.img_id}"></a>
                    <input value="{$gg2.img_id}" name="Goodsvideo[id][]" type="hidden">
                    <input value="{$gg2.goodsvideo}" name="Goodsvideo[path][]" type="hidden">
                    <!-- <span class="item_box"><img src="{$gg2.goodsvideo}"></span> -->
                    <video width="130" height="130" controls>
                    <source src="{$gg2.goodsvideo} "  type="video/mp4">
                    <source src="{$gg2.goodsvideo} "  type="video/ogg">
                  </video>
                </li>
                {/if}
   
                {/volist}
            </ul>
        </div>
    </div>
<!-- 视频上传写在这里 -->
</div>



<div class="form-group">
    <label class="col-sm-2 control-label" >商品图片：</label>
    <div class="col-sm-10">
        <div class="js_upload_container">
            <div class="js_file_upload ">
                <button type="button" class="btn btn-default js_new_upload" data-submitname="GoodsImages" data-count="20" data-uploadpath="{:url('mainAdmin/attachment/goodsUpload')}" data-delpath="{:url('mainAdmin/attachment/removeImg')}" data-data="{ 'gid':'{$row.goods_id|intval}' }" style="position: relative; z-index: 1;">商品图片</button>
                <span class="maroon">*</span>
                <span class="help-inline">(建议尺寸：640*640或800*800)默认显示第1张图片，最多20张 (<small>可拖拽图片调整显示顺序 </small>)</span>
            </div>
            <div class="uploadify-queue js_file_upload_queue">
            </div>
             <ul class="ipost-list ui-sortable js_fileList" data-required="true">
{volist name="goods_imgs" id="gg"  }
<li class="imgbox" data-post-id="{$gg.img_id}" data-path="{$gg.goods_img}">
<a class="item_new_close item_close" href="javascript:void(0)" data-delpath="{:url('mainAdmin/attachment/removeImg')}"  title="删除" data-path="{$gg.goods_img}" data-post-id="{$gg.img_id}"></a>
<input value="{$gg.img_id}" name="GoodsImages[id][]" type="hidden">
<input value="{$gg.goods_img}" name="GoodsImages[path][]" type="hidden">
<span class="item_box"><img src="{$gg.goods_thumb}"></span>
</li>
{/volist}
             </ul>
        </div>
    </div>
</div>

<div class="line line-dashed line-lg pull-in" ></div>
<div  class="form-group" >
    <label class="col-sm-2 control-label">商品规格：</label>
    <div class="col-sm-10">
        {if condition="$row.goods_id > 0" }
         <div ><span class="help-inline"> {$row.is_spec==0?'统一规格':'多规格'}</span></div>
        {/if}
            <div class="f-l {$row['goods_id'] < 1?'':'hide'}">
                <label class="radio-inline">
                    <input type="radio" name="is_spec" value="0" data-toggle="specification-enable" data-enable="false"  {$row.is_spec|tplckval='=0','checked',true}  />统一规格
                </label>
                <label class="radio-inline">
                    <input type="radio" name="is_spec" value="1"  data-toggle="specification-enable" data-enable="true" {$row.is_spec|tplckval='=1','checked'}/>
                    多规格</label>
                <span class=" help-inline">*添加商品后不能修改规格</span>
            </div>

            <div class="m-t-md col-sm-8 specificationstable hd">

                选择商品模型
                {if condition="$row.goods_id < 1" }
                <select name="sku_model" id="skuModelId" {$is_supplyer==true?'disabled':''} data-toggle="changeSkuModelId">
                {$skuModelOpt|raw}
                </select>
                <span  style="color:#f30;">* 修改模型，将会删除旧有的sku记录</span>
                {else/}
                <select disabled id="skuModelId" {$is_supplyer==true?'disabled':''} data-toggle="changeSkuModelId">
                    {$skuModelOpt|raw}
                </select>
                <input type="hidden" name="sku_model" value="{$row.sku_model|intval}">
                {/if}

            </div>



        <div class="clearfix"></div>
        <div data-toggle="specifications" class="hd"><i class="fa fa-spinner fa-spin"></i></div>

    </div>
</div>

<!-- <div  class="form-group" >
    <label class="col-sm-2 control-label">单产品分销：</label>
    <div class="col-sm-10">

            <label class="radio-inline">
                <input type="radio" name="is_distribution" value="0"  onclick="distribution()" data-toggle="specification-enable2" data-enable="false"  {$row.is_distribution|tplckval='=0','checked',true}  />否
            </label>
            <label class="radio-inline">
                <input type="radio" name="is_distribution" value="1"  onclick="distribution()" data-toggle="specification-enable2" data-enable="true" {$row.is_distribution|tplckval='=1','checked'}/>
                是</label>

    </div>
</div> -->

<!-- 
    <div class="form-group specificationstable2 {$row['is_distribution'] > 0?'':'hide'}" >
        <label class="col-sm-2 control-label">直推奖：</label>
        <div class="col-sm-4 ">
            <input type="text" class="input-medium" name="direct_reward" value="{$row.direct_reward}" data-rule-maxlength="20" data-rule-required="true" >元
            <span  style="color:#f30;"> *</span>
        </div>
        <div class="help-inline"></div>
    </div>

    <div class="form-group specificationstable2 {$row['is_distribution'] > 0?'':'hide'}" >
        <label class="col-sm-2 control-label">极差奖：</label>
        <div class="col-sm-4 ">
            <input type="text" class="input-medium" name="grade_reward" value="{$row.grade_reward}" data-rule-maxlength="20" data-rule-required="true" >元
            <span  style="color:#f30;"> *</span>
        </div>
        <div class="help-inline"></div>
    </div> -->


<div class="line line-dashed line-lg pull-in specificationstable hd" style="width:98%;"></div>

<div class="form-group specificationstable hd">
    <label class="col-sm-2 control-label">价格&库存：</label>
    <div class="table-responsive tab-content p-l" style="width:81%;" data-toggle="specificationstable">
        <span class="help-inline p-t ">请选择规格</span>
    </div>
</div>

<div class="nospecifications {$row['is_spec']==1?'hd':''}">
    {if condition="$is_supplyer == false" }
    <div class="form-group">
        <label class="col-sm-2 control-label">货号：</label>
        <div class="col-sm-4 ">
            <input type="text" class="input-medium" name="goods_sn" value="{$row.goods_sn}" data-rule-maxlength="20" data-rule-required="true" data-msg-required="商品货号不能为空">
            <span  style="color:#f30;"> *</span>
        </div>
        <div class="help-inline"></div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">条形码：</label>
        <div class="col-sm-2 ">
            <input type="text" class="input-medium" name="bar_code" value="{$row.bar_code}" data-rule-maxlength="20" >
        </div>
        <div class="help-inline"></div>
    </div>


    <div class="form-group">
        <label class="col-sm-2 control-label">重量：</label>
        <div class="col-sm-2">
            <div class="input-group" style="width: 180px;">
                <input type="text" class="input-medium" name="goods_weight" data-rule-min="0"  data-rule-number="true"  value="{$row.goods_weight}">
                <span class="input-group-addon">g</span>
            </div>
        </div>
    </div>


    <div class="form-group">
        <label class="col-sm-2 control-label">销售价：</label>
        <div class="col-sm-4">
            <input type="text" class="input-mini" name="shop_price"  data-rule-ismoney="true" data-rule-required="true" data-msg-required="销售价不能为空" value="{$row.shop_price}">
            元<span  style="color:#f30;"> *</span>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">促销价：</label>
        <div class="col-sm-8">
            <input type="text" class="input-mini" data-rule-ismoney="true" name="promote_price" value="{$row.promote_price}" >元
            <span class="help-inline">促销期间以此价格进行销售</span>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">市场价：</label>
        <div class="col-sm-4">
            <input type="text" class="input-mini" name="market_price" data-rule-ismoney="true" value="{$row.market_price}">元
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">库存：</label>
        <div class="col-sm-8">
            {$row['goods_id']>0?'当前库存：'.$row['goods_number'].' 修改当前库存为 ':''}<input type="text" class="input-mini" name="goods_number" data-rule-digits="true" data-rule-required="true" data-msg-required="库存不能为空" value="{$row['goods_number']>0?$row['goods_number']:'0'}">
            <span class="red">*</span>
        </div>
    </div>
    {else}
    <div class="form-group">
        <label class="col-sm-2 control-label">货号：</label>
        <div class="col-sm-4 ">
            <div class="help-inline">{$row['goods_sn']}</div>
        </div>
        <div class="help-inline"></div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">条形码：</label>
        <div class="col-sm-2 ">
            <div class="help-inline">{$row['bar_code']}</div>
        </div>
        <div class="help-inline"></div>
    </div>


    <div class="form-group">
        <label class="col-sm-2 control-label">重量：</label>
        <div class="col-sm-2">
            <div class="input-group" style="width:50px;">
                <input type="text" class="input-mini" name="goods_weight" data-rule-min="0"  data-rule-number="true"  value="{$row.goods_weight}">
                <span class="input-group-addon">g</span>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">市场价：</label>
        <div class="col-sm-8">
            <div class="help-inline">{$row['market_price']|priceFormat=true}</div>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">库存：</label>
        <div class="col-sm-8">
           <div class="help-inline"> {$row['goods_number']}</div>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">供货价：</label>
        <div class="col-sm-4">
            <div class="help-inline red"><b>{$row.settle_price|priceFormat=true}</b></div>
            <input type="hidden" name="settle_price" value="{$row.settle_price}">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">销售价：</label>
        <div class="col-sm-4">
            <input type="text" class="input-mini" name="shop_price" data-rule-ismoney="true" data-rule-required="true" data-msg-required="销售价不能为空" value="{$row.shop_price}">
            元<span  style="color:#f30;"> *</span>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">促销价：</label>
        <div class="col-sm-8">
            <input type="text" class="input-mini" data-rule-ismoney="true" name="promote_price" value="{$row.promote_price}" >元
            <span class="help-inline">促销期间以此价格进行销售</span>
        </div>
    </div>
    {/if}
    <div class="form-group">
        <label class="col-sm-2 control-label">排序：</label>
        <div class="col-sm-8">
           <input type="text" class="input-mini" name="sort_order"  data-rule-min="0"  data-rule-number="true" value="{$row['sort_order']}">
            <span class="red">*</span>
        </div>
    </div>
</div>

<script>
    function distribution(){
        var is_distribution =  $("input[name='is_distribution']:checked").val();
        if(is_distribution == 1){
            $('.specificationstable2').show();
            $('.specificationstable2').removeClass("hide");
        }else{
            $('.specificationstable2').hide();
        }
    }
</script>